﻿<template>
    <div id="app">
        <h-header :headertitle="title"></h-header>

        <ul v-infinite-scroll="loadMore"
            infinite-scroll-disabled="loading"
            infinite-scroll-distance="10">
     
            <div class="mui-card"  v-for="item in list">
                <!--页眉，放置标题-->
                <div class="mui-card-header">{{item.title}}<span style="float:right;font-size:14px;">{{item.onlinenum}}人在线</span></div>
                <!--内容区-->
                <div class="mui-card-content">
                    <img src="//dcloud.io/hellomui/images/yuantiao.jpg" alt="" width="100%">

                </div>
                <!--页脚，放置补充信息或支持的操作-->
                <div class="mui-card-footer">{{item.desc}}</div>
            </div>
        </ul>

      
    </div>

</template>

<script>
    import header from '../components/header.vue';
    export default {
        name: 'app',
        data() {
            return {
                title:'视频',
                page: 1,
                list:[]
            }
        },
        components: {
            'h-header': header,
        },
        mounted() {
            //   this.pushHistory()
            // 监听历史记录点, 添加返回事件监听
            window.onpopstate = () => {
                Bus.$emit('val', "show");
                //  this.$router.back();
            }
        },
        methods:
        {
           
            loadMore() {
                this.loading = true;
                this.$data.page = this.$data.page + 1;
                this.load();
            },
            load: function () {
                var mid = window.localStorage.getItem("mid");
                var page = this.$data.page;
                var _this = this;
                this.$api.post('wx/Index/getvideo', {
                    "mid": mid, "page": page
                }, response => {
                    if (response.status >= 200 && response.status < 300) {
                        console.log(response.data);
                        var data = response.data;
                        if (data.status == 200) {

                            for (var i = 0; i < data.data.length; i++) {

                                _this.$data.list.push(data.data[i]);
                            }
                           


                        }


                        console.log(_this.$data.list);
                        
                        //请求成功，response为成功信息参数
                    } else {
                        console.log(response.message);
                        //请求失败，response为失败信息
                    }
                });

            }
        },
        created: function () {
          this.load();
        }
        
    }
</script>

<style scoped>
    @import "../assets/css/mui.min.css";
</style>